﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sinacor.Infra.Core.Licensing
{
    [Serializable]
    public enum Treaty
    {
        Trial = 1,
        Modulo = 2,
        Usuario = 3,
        Completa = 4
    }
    [Serializable]
    public class TreatyConverter
    {

        public static Treaty ConvertIntToTreaty(int treatyInt)
        {
            Treaty treaty = new Treaty();

            switch (treatyInt)
            {
                case 1:
                    treaty = Treaty.Trial;
                    break;
                case 2:
                    treaty = Treaty.Modulo;
                    break;
                case 3:
                    treaty = Treaty.Usuario;
                    break;

                case 4:
                    treaty = Treaty.Completa;
                    break;
                default:
                    treaty = Treaty.Trial;
                    break;
            }

            return treaty;
        }

        public static int ConvertTreatyToInt(Treaty treaty)
        {
            int result = -1;

            switch (treaty)
            {
                case Treaty.Trial:
                    result = 1;
                    break;
                case Treaty.Modulo:
                    result = 2;
                    break;
                case Treaty.Usuario:
                    result = 3;
                    break;
                case Treaty.Completa:
                    result = 4;
                    break;
            }

            return result;
        }

    }
}
